﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Card.Common;

namespace Card.Web
{
    public partial class Help : BasePage
    {
        protected override void InitArea()
        {
            _Area = Card.Common.AreaCache.GetAreaByCode(CardWebUtility.GetAreaCode());

            if ((_Area == null || string.Compare(_Area.IsActive, CONST.YES_NO.YES) != 0) && !this.ValidateCity)
            {
                _Area = Card.Common.AreaCache.GetAreaByCode(Card.Security.CookieManager.GetArea());
                if (_Area == null || string.Compare(_Area.IsActive, CONST.YES_NO.YES) != 0)
                {
                    _Area = Card.Common.AreaCache.GetAreaByCode(CONST.MainArea);
                }
            }
        }

        public string LookUpCode
        {
            get
            {
                return string.IsNullOrEmpty(Request.QueryString["t"]) ? "ABOUT" : Request.QueryString["t"].ToUpper();
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.DoInit();
        }

        private void DoInit()
        {
            BAF.Entity.LookupValue lookUp = Common.LookUpCache.GetLookupValue(CONST.LOOKUP_TYPE.HELP, this.LookUpCode);
            if (lookUp != null)
            {
                this.ltlTitle.Text = lookUp.Value;
                this.ltlContent.Text = lookUp.TextValue;
            }
        }
    }
}
